package com.wst.system.controller;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wst.system.config.exception.GlobalExcetion;
import com.wst.system.server.entity.SysOpenApp;
import com.wst.system.server.entity.vo.PageSearchVo;
import com.wst.system.server.service.SysOpenAppService;
import com.wst.system.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("sysapp")
public class SysAppController {

    @Autowired
    private SysOpenAppService sysOpenAppService;

    @GetMapping("/page")
    public JSONObject page(@RequestBody @Validated PageSearchVo pageSearchVo) throws GlobalExcetion {
        IPage<SysOpenApp> sysOpenAppIPage=sysOpenAppService.page(pageSearchVo);
        return ResultUtil.successInfoTable(sysOpenAppIPage.getTotal(),sysOpenAppIPage.getRecords());
    }
}
